package main

import (
	"fmt"
	"gitee.com/iralance/gin-blog-example/models"
	"gitee.com/iralance/gin-blog-example/pkg/logging"
	"gitee.com/iralance/gin-blog-example/pkg/setting"
	"gitee.com/iralance/gin-blog-example/pkg/util"
	"gitee.com/iralance/gin-blog-example/routers"
	"net/http"
)

func init() {
	logging.Setup()
	setting.Setup()
	models.Setup()
	util.Setup()
}

func main() {
	r := routers.InitRouter()
	s := &http.Server{
		Addr:              fmt.Sprintf(":%d", setting.ServerSetting.HttpPort),
		Handler:           r,
		ReadTimeout:       setting.ServerSetting.ReadTimeout,
		ReadHeaderTimeout: setting.ServerSetting.WriteTimeout,
		MaxHeaderBytes:    1 << 20,
	}
	s.ListenAndServe()
}
